<?

	header( "Cache-control: private" );
	header( "Content-type: application/json" );
	
	$response	= (object) null;
	$task 		= simplestring( $_POST['task']);


#	Check Authorisation request
#	LOAD REQUESTED TASK

	if ( $task == 'login'
	|| ( $Engine->user_session( 1 ) && $task )) {
	
		include ENGINE_CORE . 'control.11/request.php';
		$ctrl		= "XHR" . $task;
		$Request	= new $ctrl();
	 
		$response	= $Request->response(); 

#	UNVALIDATE USER SESSION

	}	else if( !$task ) 	$response->redirect = "?fresh";
		else				$response->error = "not authorised";



#	JSON Stringify response object
	echo json_encode( $response );